<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
  <title>The source code</title>
    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body  onload="prettyPrint();">
    <pre class="prettyprint lang-js"><div id="cls-Ext.is"></div>/**
 * @class Ext.is
 * 
 * Determines information about the current platform the application is running on.
 * 
 * @singleton
 */
Ext.is = {
    init : function() {
        var platforms = this.platforms,
            ln = platforms.length,
            i, platform;

        for (i = 0; i < ln; i++) {
            platform = platforms[i];
            this[platform.identity] = platform.regex.test(platform.string);
        }

        <div id="prop-Ext.is-Desktop"></div>/**
         * @property Desktop True if the browser is running on a desktop machine
         * @type {Boolean}
         */
        this.Desktop = this.Mac || this.Windows || (this.Linux && !this.Android);
        <div id="prop-Ext.is-Tablet"></div>/**
         * @property Tablet True if the browser is running on a tablet (iPad)
         */
        this.Tablet = this.iPad;
        <div id="prop-Ext.is-Phone"></div>/**
         * @property Phone True if the browser is running on a phone.
         * @type {Boolean}
         */
        this.Phone = !this.Desktop && !this.Tablet;
        <div id="prop-Ext.is-iOS"></div>/**
         * @property iOS True if the browser is running on iOS
         * @type {Boolean}
         */
        this.iOS = this.iPhone || this.iPad || this.iPod;
        
        <div id="prop-Ext.is-Standalone"></div>/**
         * @property Standalone Detects when application has been saved to homescreen.
         * @type {Boolean}
         */
        this.Standalone = !!window.navigator.standalone;
    },
    
    <div id="prop-Ext.is-iPhone"></div>/**
     * @property iPhone True when the browser is running on a iPhone
     * @type {Boolean}
     */
    platforms: [{
        string: navigator.platform,
        regex: /iPhone/i,
        identity: 'iPhone'
    },
    
    <div id="prop-Ext.is-iPod"></div>/**
     * @property iPod True when the browser is running on a iPod
     * @type {Boolean}
     */
    {
        string: navigator.platform,
        regex: /iPod/i,
        identity: 'iPod'
    },
    
    <div id="prop-Ext.is-iPad"></div>/**
     * @property iPad True when the browser is running on a iPad
     * @type {Boolean}
     */
    {
        string: navigator.userAgent,
        regex: /iPad/i,
        identity: 'iPad'
    },
    
    <div id="prop-Ext.is-Blackberry"></div>/**
     * @property Blackberry True when the browser is running on a Blackberry
     * @type {Boolean}
     */
    {
        string: navigator.userAgent,
        regex: /Blackberry/i,
        identity: 'Blackberry'
    },
    
    <div id="prop-Ext.is-Android"></div>/**
     * @property Android True when the browser is running on an Android device
     * @type {Boolean}
     */
    {
        string: navigator.userAgent,
        regex: /Android/i,
        identity: 'Android'
    },
    
    <div id="prop-Ext.is-Mac"></div>/**
     * @property Mac True when the browser is running on a Mac
     * @type {Boolean}
     */
    {
        string: navigator.platform,
        regex: /Mac/i,
        identity: 'Mac'
    },
    
    <div id="prop-Ext.is-Windows"></div>/**
     * @property Windows True when the browser is running on Windows
     * @type {Boolean}
     */
    {
        string: navigator.platform,
        regex: /Win/i,
        identity: 'Windows'
    },
    
    <div id="prop-Ext.is-Linux"></div>/**
     * @property Linux True when the browser is running on Linux
     * @type {Boolean}
     */
    {
        string: navigator.platform,
        regex: /Linux/i,
        identity: 'Linux'
    }]
};

Ext.is.init();

<div id="cls-Ext.supports"></div>/**
 * @class Ext.supports
 *
 * Determines information about features are supported in the current environment
 * 
 * @singleton
 */
Ext.supports = {
    init : function() {
        var doc = document,
            div = doc.createElement('div'),
            tests = this.tests,
            ln = tests.length,
            i, test;

        div.innerHTML = [
            '<div style="height:30px;width:50px;">',
                '<div style="height:20px;width:20px;"></div>',
            '</div>',
            '<div style="float:left; background-color:transparent;"></div>'
        ].join('');

        doc.body.appendChild(div);

        for (i = 0; i < ln; i++) {
            test = tests[i];
            this[test.identity] = test.fn.call(this, doc, div);
        }

        doc.body.removeChild(div);
    },

    <div id="prop-Ext.supports-OrientationChange"></div>/**
     * @property OrientationChange True if the device supports orientation change
     * @type {Boolean}
     */
    OrientationChange: !Ext.is.Desktop && (((typeof window.orientation != 'undefined') || window.hasOwnProperty('orientation')) && ('onorientationchange' in window)),

    tests: [
        <div id="prop-Ext.supports-Transitions"></div>/**
         * @property Transitions True if the device supports CSS3 Transitions
         * @type {Boolean}
         */
        {
            identity: 'Transitions',
            fn: function(doc, div) {
                var prefix = [
                        'webkit',
                        'Moz',
                        'o',
                        'ms',
                        'khtml'
                    ],
                    TE = 'TransitionEnd',
                    transitionEndName = [
                        prefix[0] + TE,
                        'transitionend', //Moz bucks the prefixing convention
                        prefix[2] + TE,
                        prefix[3] + TE,
                        prefix[4] + TE
                    ],
                    ln = prefix.length,
                    i = 0,
                    out = false;
                div = Ext.get(div);
                for (; i < ln; i++) {
                    if (div.getStyle(prefix[i] + "TransitionProperty")) {
                        Ext.supports.CSS3Prefix = prefix[i];
                        Ext.supports.CSS3TransitionEnd = transitionEndName[i];
                        out = true;
                        break;
                    }
                }
                return out;
            }
        },
        
        <div id="prop-Ext.supports-Touch"></div>/**
         * @property Touch True if the device supports touch 
         * @type {Boolean}
         */
        {
            identity: 'Touch',
            fn: function(doc, div) {
                return (!Ext.is.Desktop && ('ontouchstart' in div));
            }
        },
        
        <div id="prop-Ext.supports-RightMargin"></div>/**
         * @property RightMargin True if the device supports right margin
         * @type {Boolean}
         */
        {
            identity: 'RightMargin',
            fn: function(doc, div, view) {
                view = doc.defaultView;
                return !(view && view.getComputedStyle(div.firstChild.firstChild, null).marginRight != '0px');
            }
        },
        
        <div id="prop-Ext.supports-TransparentColor"></div>/**
         * @property TransparentColor True if the device supports transparent color
         * @type {Boolean}
         */
        {
            identity: 'TransparentColor',
            fn: function(doc, div, view) {
                view = doc.defaultView;
                return !(view && view.getComputedStyle(div.lastChild, null).backgroundColor != 'transparent');
            }
        },
        
        <div id="prop-Ext.supports-SVG"></div>/**
         * @property SVG True if the device supports SVG
         * @type {Boolean}
         */
        {
            identity: 'SVG',
            fn: function(doc) {
                return !!doc.createElementNS && !!doc.createElementNS( "http:/" + "/www.w3.org/2000/svg", "svg").createSVGRect;
            }
        },
    
        <div id="prop-Ext.supports-Canvas"></div>/**
         * @property Canvas True if the device supports Canvas
         * @type {Boolean}
         */
        {
            identity: 'Canvas',
            fn: function(doc) {
                return !!doc.createElement('canvas').getContext;
            }
        },
        
        <div id="prop-Ext.supports-VML"></div>/**
         * @property VML True if the device supports VML
         * @type {Boolean}
         */
        {
            identity: 'VML',
            fn: function(doc) {
                var d = doc.createElement("div");
                d.innerHTML = "<!--[if vml]><br><br><![endif]-->";
                return (d.childNodes.length == 2);
            }
        },
        
        <div id="prop-Ext.supports-Float"></div>/**
         * @property Float True if the device supports CSS float
         * @type {Boolean}
         */
        {
            identity: 'Float',
            fn: function(doc, div) {
                return !!div.lastChild.style.cssFloat;
            }
        },
        
        <div id="prop-Ext.supports-AudioTag"></div>/**
         * @property AudioTag True if the device supports the HTML5 audio tag
         * @type {Boolean}
         */
        {
            identity: 'AudioTag',
            fn: function(doc) {
                return !!doc.createElement('audio').canPlayType;
            }
        },
        
        <div id="prop-Ext.supports-History"></div>/**
         * @property History True if the device supports HTML5 history
         * @type {Boolean}
         */
        {
            identity: 'History',
            fn: function() {
                return !!(window.history && history.pushState);
            }
        },
        
        <div id="prop-Ext.supports-CSS3DTransform"></div>/**
         * @property CSS3DTransform True if the device supports CSS3DTransform
         * @type {Boolean}
         */
        {
            identity: 'CSS3DTransform',
            fn: function() {
                return (typeof WebKitCSSMatrix != 'undefined' && new WebKitCSSMatrix().hasOwnProperty('m41'));
            }
        },
        
        <div id="prop-Ext.supports-GeoLocation"></div>/**
         * @property GeoLocation True if the device supports GeoLocation
         * @type {Boolean}
         */
        {
            identity: 'GeoLocation',
            fn: function() {
                return (typeof navigator != 'undefined' && typeof navigator.geolocation != 'undefined') || (typeof google != 'undefined' && typeof google.gears != 'undefined');
            }
        }
    ]
};</pre>    
</body>
</html>